package com.wiz.netty.handler;

import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext;

import com.wiz.common.NettyConstant;
import com.wiz.log.NettyInfoRecord;
import com.wiz.netty.NettyXmlParseFactory;
import com.wiz.web.manager.ServiceManager;

/**
 * 
 * @author Hakeny
 */
public abstract class AbstractHandlerAdapter extends ChannelHandlerAdapter implements NettyConstant{

	protected ServiceManager serviceManager;
	protected NettyXmlParseFactory wizXmlFactory;
	
	/**
	 * 清除句柄及在线信息
	 * @param ctx
	 */
	protected void destroyHandler(ChannelHandlerContext ctx, String wcall){
		String key = serviceManager.removeMapByValue(ctx);
		NettyInfoRecord.infoRecord("stationId="+key+"  channelId="+ctx.channel().id().asLongText()+" destroyHandler in "+wcall);
		ctx.close();
	}
}
